#pragma once

#include "Logger.h"

namespace xncc {
extern xncc::Logger plat_logger;
#define PLAT_LOG (xncc::plat_logger)

namespace shared {
    extern const char* strerror_tl(int savedErrno);
}  // namespace shared

#define SYSTEM_ERROR                                                                                                   \
    xncc::LogObject(xncc::LOG_LEVEL::ERROR, __FILE__, __LINE__, __FUNCTION__, PLAT_LOG.loggerId())                     \
        << "[" << errno << "->" << (shared::strerror_tl(errno)) << ("]")

#define TRACE_ERROR xncc::LogObject(xncc::LOG_LEVEL::ERROR, __FILE__, __LINE__, __FUNCTION__, PLAT_LOG.loggerId())

#define TRACE_INFO                                                                                                     \
    if (PLAT_LOG.getLevel() >= xncc::LOG_LEVEL::INFO)                                                                  \
    xncc::LogObject(xncc::LOG_LEVEL::INFO, __FILE__, __LINE__, __FUNCTION__, PLAT_LOG.loggerId())

#define TRACE_DEBUG                                                                                                    \
    if (PLAT_LOG.getLevel() >= xncc::LOG_LEVEL::DEBUG)                                                                 \
    xncc::LogObject(xncc::LOG_LEVEL::DEBUG, __FILE__, __LINE__, __FUNCTION__, PLAT_LOG.loggerId())
}  // namespace xncc
